﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<UI.Data.Producto>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Crear una publicacion
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <form id="form1" runat="server">
    <h2>
        Crear una publicacion</h2>
    <% using (Html.BeginForm("Create", "Product", FormMethod.Post, new { enctype = "multipart/form-data" }))
       { %>
    <%: Html.ValidationSummary(false) %>
    <fieldset>
        <legend>Crear su publicacion de venta</legend>
        <div class="editor-label">
            <%: Html.Label("Nombre del producto: ") %>
        </div>
        <div class="editor-field">
            <%: Html.EditorFor(model => model.Nombre) %>
            <%: Html.ValidationMessageFor(model => model.Nombre) %>
        </div>
        <div class="editor-label">
            <%: Html.Label("Descripcion: ")%>
        </div>
        <div class="editor-field">
            <%: Html.EditorFor(model => model.Descripcion) %>
            <%: Html.ValidationMessageFor(model => model.Descripcion) %>
        </div>
        <div class="editor-label">
            <%: Html.Label("Cantidad: ")%>
        </div>
        <div class="editor-field">
            <%: Html.EditorFor(model => model.Stock) %>
            <%: Html.ValidationMessageFor(model => model.Stock) %>
        </div>
        <div class="editor-label">
            <%: Html.Label("Para que deporte?: ")%>
        </div>
        <div class="editor-field">
            <%UI.Data.SPORTSALEEntities context = new UI.Data.SPORTSALEEntities(); %>
            <%: Html.DropDownListFor(model => model.IdDeporte, new SelectList(context.Deportes.Select(x => new { Value = x.Id, Text = x.Nombre }),"Value","Text")) %>
            <%: Html.ValidationMessageFor(model => model.IdDeporte, "Debe de seleccionar un deporte")%>
        </div>
        <div class="editor-label">
            <%: Html.Label("Precio unitario: ")%>
        </div>
        <div class="editor-field">
            <%: Html.EditorFor(model => model.Precio) %>
            <%: Html.ValidationMessageFor(model => model.Precio) %>
        </div>
        <div class="editor-label">
            <%: Html.Label("Imagen: ")%>
        </div>
        <div class="editor-field">
            <%: Html.TextBoxFor(x => x.Imagen, new { type="file" }) %>
        </div>
        <p>
            <input type="submit" value="Crear publicacion" class="btn btn-primary" />
        </p>
    </fieldset>
    <% } %>
    <div>
        <%: Html.ActionLink("Volver", "List", null, new { @class = "btn btn-danger" })%>
    </div>
    </form>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="FeaturedContent" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ScriptsSection" runat="server">
    <%: Scripts.Render("~/bundles/jqueryval") %>
</asp:Content>
